﻿<%@ Page Title="" Language="C#" MasterPageFile="~/MemberUser/MemberMaster.Master"
    AutoEventWireup="true" CodeBehind="Comment.aspx.cs" Inherits="ZLCMS.Web.MemberUser.Comment" %>

<%@ Import Namespace="ZLCMS.Business.Util" %>
<%@ MasterType VirtualPath="~/MemberUser/MemberMaster.Master" %>
<%@ Register Src="UC/MemberCategory.ascx" TagName="MemberCategory" TagPrefix="uc1" %>
<%@ Register Src="UC/Ad_Right.ascx" TagName="Ad_Right" TagPrefix="uc2" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <script src="/js/xheditor/xheditor-zh-cn.min.js" type="text/javascript"></script>
    <style type="text/css">
        #star
        {
            position: relative;
            margin-bottom: 20px;
            height: 24px;
        }
        #star ul, #star span
        {
            float: left;
            display: inline;
            height: 19px;
            line-height: 19px;
        }
        #star ul
        {
            margin: 0 10px;
        }
        #star li
        {
            float: left;
            width: 24px;
            cursor: pointer;
            text-indent: -9999px;
            background: url(../images/starrating.gif) no-repeat;
        }
        #star strong
        {
            color: #f60;
            padding-left: 10px;
        }
        #star li.on
        {
            background-position: 0 -35px;
        }
        #star p
        {
            position: absolute;
            top: 20px;
            width: 159px;
            height: 60px;
            display: none;
            background: url(../images/icon.gif) no-repeat;
            padding: 7px 10px 0;
        }
        #star p em
        {
            color: #f60;
            display: block;
            font-style: normal;
        }
    </style>
    <script type="text/javascript">

        window.onload = function () {

            var oStar = document.getElementById("star");
            var aLi = oStar.getElementsByTagName("li");
            var oUl = oStar.getElementsByTagName("ul")[0];
            var oSpan = oStar.getElementsByTagName("span")[1];
            var oP = oStar.getElementsByTagName("p")[0];
            var i = iScore = iStar = 0;
            var aMsg = [
				"很不满意|差得太离谱，与卖家描述的严重不符，非常不满",
				"不满意|部分有破损，与卖家描述的不符，不满意",
				"一般|质量一般，没有卖家描述的那么好",
				"满意|质量不错，与卖家描述的基本一致，还是挺满意的",
				"非常满意|质量非常好，与卖家描述的完全一致，非常满意"
				]

            for (i = 1; i <= aLi.length; i++) {
                aLi[i - 1].index = i;

                //鼠标移过显示分数
                aLi[i - 1].onmouseover = function () {
                    fnPoint(this.index);
                    //浮动层显示
                    oP.style.display = "block";
                    //计算浮动层位置
                    oP.style.left = oUl.offsetLeft + this.index * this.offsetWidth - 104 + "px";
                    //匹配浮动层文字内容
                    oP.innerHTML = "<em><b>" + this.index + "</b> 分 " + aMsg[this.index - 1].match(/(.+)\|/)[1] + "</em>" + aMsg[this.index - 1].match(/\|(.+)/)[1]
                };
                //鼠标离开后恢复上次评分
                aLi[i - 1].onmouseout = function () {
                    fnPoint();
                    //关闭浮动层
                    oP.style.display = "none"
                };
                //点击后进行评分处理
                aLi[i - 1].onclick = function () {
                    iStar = this.index;
                    $('#score').val(iStar);
                    oP.style.display = "none";
                    oSpan.innerHTML = "<strong>" + (this.index) + " 分</strong> (" + aMsg[this.index - 1].match(/\|(.+)/)[1] + ")";
                    $("#ctl00_ctl00_ContentPlaceHolder1_ContentPlaceHolder1_hdf_score").val(this.index);
                }
                var score = 0;
                score = parseInt(score) - 1;
                if (score >= 0) {
                    $(aLi[score]).trigger("click");
                    $(aLi[score]).trigger("mouseover");
                    $(aLi[score]).trigger("mouseout");
                }
            }
            //评分处理
            function fnPoint(iArg) {
                //分数赋值
                iScore = iArg || iStar;
                for (i = 0; i < aLi.length; i++) aLi[i].className = i < iScore ? "on" : "";
            }
        };
    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <!--wrapper start-->
    <div id="wrapper">
        <!--left start-->
        <div class="shop_left">
            <uc1:MemberCategory ID="MemberCategory1" runat="server" />
        </div>
        <!--left end-->
        <!--centent start-->
        <div class="shop_centent">
            <h2>
                产品评论</h2>
            <div class="box">
                <div class="regist_box no_bxd" style="height: 750px;">
                    <div class="r_left">
                        <div class="tabs_box">
                            <div class="con1">
                              <form id="form1" command='CommentProduct' class="registerform">
                                <div class="inp">
                                    <div id="star" style="width: 600px;">
                                        <span>星星评分：</span>
                                        <ul>
                                            <li><a href="javascript:;">1</a></li>
                                            <li><a href="javascript:;">2</a></li>
                                            <li><a href="javascript:;">3</a></li>
                                            <li><a href="javascript:;">4</a></li>
                                            <li><a href="javascript:;">5</a></li>
                                        </ul>
                                        <span></span>
                                        <p>
                                        </p>
                                    </div>
                                </div>
                                <div class="inp">
                                    <label style="text-align: left;">
                                        评语：</label>&nbsp;&nbsp;
                                    <textarea name="content" id="ta_comment" command-param='Content' class="editor {width:'400'}"
                                        cols="100" rows="8" maxlength="200" style="resize: none; width: 500px;"> 
                    &nbsp;
                    </textarea>
                                    <div class="clear">
                                    </div>
                                </div>
                                <div class="checktip">
                                    <span class="Validform_checktip"></span>
                                </div>
                                <p class="tijiao">
                                        <input type="button" class="submit" value="提交" onclick="ExecuteFormCommonCommand('form1', succeedCallback)">
                                </p>
                                <input type=hidden  command-param='Score' value="0" id="score"/>
   <input type=hidden  command-param='ProductNo' value="<%=Product.ProductNo %>"/>
   <input type=hidden  command-param='MemberAccount' value="<%=CurrentMemberAccount %>"/>
                                </form>
                            </div>
                        </div>
                    </div>
                    <div class="clear">
                    </div>
                </div>
            </div>
        </div>
        <div>
        </div>
        <!--centent end-->
        <!--right start-->
        <div class="shop_right">
            <uc2:Ad_Right ID="Ad_Right1" runat="server" />
        </div>
        <!--right end-->
        <div class="clear">
        </div>
    </div>
    <div id="div_meitu" style="display: none">
        <div id="altContent">
        </div>
    </div>
    <!--wrapper end-->
    <script type="text/javascript">
        $(function () {
            $("#form1").openValidform(); 
        });

        $("textarea.editor").each(function () {
            var $this = $(this);
            var op = { html5Upload: false, skin: 'vista', tools: $this.attr("tools") || 'full' };
            var upAttrs = [
				["upLinkUrl", "upLinkExt", "zip,rar,txt"],
				["upImgUrl", "upImgExt", "jpg,jpeg,gif,png"],
				["upFlashUrl", "upFlashExt", "swf"],
				["upMediaUrl", "upMediaExt", "avi"]
			];

            $(upAttrs).each(function (i) {
                var urlAttr = upAttrs[i][0];
                var extAttr = upAttrs[i][1];

                if ($this.attr(urlAttr)) {
                    op[urlAttr] = $this.attr(urlAttr);
                    op[extAttr] = $this.attr(extAttr) || upAttrs[i][2];
                }
            });

            $this.xheditor(op);
        });
       

        function succeedCallback(result, totalCount) {
          alert('评论成功');
            setTimeout(function () {
                location.href = '/memberuser/WaitForCommentProList.aspx';
            }, 2000);
        }
    </script>
</asp:Content>
